/**
 * @Author 韦建韩
 * @Date 2022/8/8
 */
package com.example.devops.util;

import com.example.devops.Conntext.TokenContext;
import com.example.devops.entity.pojo.User;
import com.wjh.model.JWTArg;
import com.wjh.util.JWTUtil;

import java.util.HashMap;
import java.util.Map;

public class JwtUtil {
    public static String getTokenString(User user){
        Map<String,Object> map = new HashMap<>();
        map.put("account", user.getAccount());
        map.put("userName", user.getAccount());
        JWTArg arg = JWTArg.builder().key(TokenContext.tokenKey)
                .subject(user.getAccount())
                .m(map)
                .build();
        String token = JWTUtil.createJWT(arg);
        return token;

    }
}
